<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html>
 <head>
    <title>工单及非工单领料批次管理</title>
    <!-- import css and js -->
	<%@ include file="/common/meta.jsp" %>
	<%@ include file="/common/metaInput.jsp" %>  
	<script src="${ctx}/js/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctx}/js/jsp/yd/logic/ItemStateData.js"></script>
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript">
		var basic_Url="${ctx}/yd/logic/proget";
		var ItemStateList = ItemStateData.Rows;
// 		var item = eval("("+'${lGetItemBatchDO}'+")");
		var item = null;
		var lGetItemDO = '${lGetItemDO}';
		var whCode = '${whcode}';
		var grid;
		var checkedCustomer = new Array();
	//	alert("aaaaa:"+'${billStatus}');
	
		   function createSearch(){
			init(1,6,'60,100','10%');
			addCommon(0,0,"lable","批次：");
			addCommon(0,1,"txtlike","batch");
		} 
		
		function searchAP(){
			multipleSearch("#table1",true,"",basic_Url+"/batchlist.do?itembatch="+encodeURIComponent(lGetItemDO)+"&whcode="+whCode);
		} 
		// 清空页面查询条件
		var clearSearch1 = function() {
			$("#batch").val("");
			$("tbody tr td span", "#multipleSearchDialog").each(function(i) {
				$(".searchString", this).val("");
			});
		};   
		$(function(){
			// 显示或者隐藏查询
		        $("#case").click(function(){
		           if($("#case").val()=="展开查询") {
		             $("#case").val("收起查询");
		             $("#pageHeader").show();
		           }else {
		               $("#case").val("展开查询");
		               $("#pageHeader").hide();
		           }
		         });
			var column1 =  [
			{ display: 'id', name: 'id',type: 'string',editor : {type :'false'},hide:1},
			{ display: 'materialsid', name: 'materialsid',hide:1,editor : {type :'false'},width:1},
			{ display: '<font color="gray">编码</font>', name: 'code',editor : {type :'false'},width: 100,hide:true},
			{ display: '<font color="gray">名称</font>', name: 'name',editor : {type :'false'},width: 60,hide:true},
			{ display: '<font color="gray">型号</font>', name: 'spec' ,editor : {type :'false'},width: 120,hide:true},
			{ display: '<font color="gray">基本单位</font>', name: 'junit' ,editor : {type :'false'},width: 90,hide:true},
			{ display: '<font color="gray">基本单位数量(订单)</font>', name: 'jquantuty',editor : {type :'false'},width: 120,hide:true},
			{ display: '<font color="gray">基本单位已出库数量</font>', name: 'ycksl',editor : {type :'false'},width: 120,hide:true },
			{ display: '<font color="gray">基本单位库存数量</font>', name: 'kcsl',editor : {type :'false'},width: 120 },
				{ display: '批次<font color="red">*</font>', name: 'batch', width: 90,editor : {type :'false'},
// // 					editor: { type: 'selectbatch',whcode:'whCode', databatch:'batchItem',path:'${ctx}/yd/logic/otherOutwh/getWhBatch.do', valueColumnName: 'batch', displayColumnName: 'batch',
// // 			        ext :
// // 			            function (rowdata)
// // 			            {
// // 			                return {
// // 			                    onBeforeOpen: function(){
// // 			                    	if(whCode==null || ""==whCode){
// // 				              			$.dialog.alert("请先选择仓库");
// // 				              			return ;
// // 				              		}
// // 			                    	getDG().dialog({
// // 							    		title:'选择批次',
// // 							    		width : 300,
// // 										height : 350,
// // 										content: 'url:' + sys_context+'/public/windowalert/itembatch.do?whCode=' +whCode+'&maCode='+rowdata.code,//
// // 							    		lock : true,
// // 							    		max : true,
// // 							    		min : true,
// // 							    		ok: function(){
// // 							    			var rows = this.content.getSelected();
// // 											if (rows != null && undefined != rows && ""!=rows) {
// // 												grid.updateCell('batch', rows[0].batch, rowdata);
// // 												grid.endEdit();
// // 												getBatchkcQuantity(rowdata);
// // 											}
// // 							    			this.content.Close();
// // 							        		return false;
// // 							    	    },
// // 							    	    cancelVal: '关闭',
// // 							    	    cancel: function(){
// // 							    	    	grid.endEdit();
// // 							    	    } 
// // 							    	}).zindex();
// // 			                    }, render: function ()
// // 			                    { 
// // 			                    	var batchItem = $.parseJSON($("#batchItem").val());
// // 			        		  		if(batchItem!=null){
// // 			        			 	for (var i = 0; i < batchItem.length; i++)
// // 			                 			{
// // 			                     			if (batchItem[i]['batch'] == rowdata.batch){
// // 			                        	 		return batchItem[i]['batch'];
// // 			                     			} 
// // 			                 			}
// // 			        		  		}
// // 			                    }
			
// // 			                };
// // 			            }
// // 					 }, render: function (item)
// // 			        {
// // 					 		var batchItem = $.parseJSON($("#batchItem").val());
// // 				  		if(batchItem!=null){
// // 					 	for (var i = 0; i < batchItem.length; i++)
// // 			     			{
// // 			         			if (batchItem[i]['batch'] == item.batch){
// // 			            	 		return batchItem[i]['batch'];
// // 			         			} 
// // 			     			}
// // 				  		}
// // 			            return item.batch;
// // 			        }
			},
		 	 { display: '状态<font color="red">*</font>', name: 'status',editor : {type :'false'}, width: 60,
				//editor: { type: 'select', data: ItemStateList, valueColumnName: 'ItemStateID', displayColumnName: 'ItemStateName',onChanged:getkcQuantity}, 
				render: function (item)
			    {
			    for (var i = 0; i < ItemStateList.length; i++)
			    {
			        if (ItemStateList[i]['ItemStateID'] == item.status){
			      	  return ItemStateList[i]['ItemStateName'];
			        }
			    }
			    return item.status;
			}}, 
			{ display: '单位<font color="red">*</font>', name: 'unit',editor : {type :'false'}, width: 60},
		    { display: '<font color="gray">单位换算率</font>', name: 'unitconvert',editor : {type :'false'},width:80,hide:true},
		    { display: '<font color="gray">基本单位数量(本次出库)</font>', name: 'actureQuantity',width: 130},
			{ display: '本次出库数量<font color="red">*</font>', name: 'quantuty',width: 110,editor : {type :'float',onChanged: CheckedValue}, render: function (item)
			{
				if(item.quantuty!=null &&""!=item.quantuty&&item.quantuty!=undefined&&!isNaN(item.quantuty)){
					grid.updateCell('val', item.quantuty, item);
				}
				
				if(item.whetherSelect=="OK" || findCheckedCustomer(item.customerID) > -1){
					if(item.quantuty!=''&&item.quantuty!=null&&item.unitconvert!=null&&item.unitconvert!=''&&!isNaN(item.quantuty)){
				   		grid.updateCell('actureQuantity', item.quantuty*item.unitconvert, item);
				   }
				}else{
					item.quantuty="";
				}
			   
			   return item.quantuty;
			}},
			{ display: 'customerID', name: 'customerID', width:  1,hide:1},
			{ display: 'bz', name: 'manipulation',editor : {type :'false'}, width: 1,hide:1},
			{ display: '值', name: 'val', width:  1,hide:1},
			{ display: '操作',width: 100,name:"whetherSelect", width: 1,hide:1
// 			    render: function (record, rowindex, value, column) {
// 			    	var h ="";
// 			    	if(record.whetherSelect=="OK"){
// // 			    		if (!record._editing)
// // 	                    {
// // 	                        h += "<a href='javascript:beginEdit(" + rowindex + ")'>修改</a> ";
// // 	                        h += "<a href='javascript:cancelEdit(" + rowindex + ")'>取消</a> ";
// // 	                    }
// // 	                    else
// // 	                    {
// 	                        h += "<a href='javascript:endEdit(" + rowindex + ")'>提交</a> ";
// 	                        h += "<a href='javascript:cancelEdit(" + rowindex + ")'>取消</a> "; 
// // 	                    }
			    		
// 			    	}else{
// 			    		h="提交  取消";
// 			    	}
			    	
//                       return h;
// 				  }
			}
			];
			
			
			var column2 =  [
			    			{ display: 'id', name: 'id',type: 'string',editor : {type :'false'},hide:1},
			{ display: 'materialsid', name: 'materialsid',hide:1,editor : {type :'false'},width:1},
			{ display: '<font color="gray">编码</font>', name: 'code',editor : {type :'false'},width: 100,hide:true},
			{ display: '<font color="gray">名称</font>', name: 'name',editor : {type :'false'},width: 60,hide:true},
			{ display: '<font color="gray">型号</font>', name: 'spec' ,editor : {type :'false'},width: 120,hide:true},
			{ display: '<font color="gray">基本单位</font>', name: 'junit' ,editor : {type :'false'},width: 90,hide:true},
			{ display: '<font color="gray">基本单位数量(订单)</font>', name: 'jquantuty',editor : {type :'false'},width: 120,hide:true},
			{ display: '<font color="gray">基本单位已出库数量</font>', name: 'ycksl',editor : {type :'false'},width: 120,hide:true },
			{ display: '<font color="gray">基本单位库存数量</font>', name: 'kcsl',editor : {type :'false'},width: 120 },
				{ display: '批次<font color="red">*</font>', name: 'batch', width: 90,editor : {type :'false'},
			},
		 	 { display: '状态<font color="red">*</font>', name: 'status',editor : {type :'false'}, width: 80,
				render: function (item)
			    {
			    for (var i = 0; i < ItemStateList.length; i++)
			    {
			        if (ItemStateList[i]['ItemStateID'] == item.status){
			      	  return ItemStateList[i]['ItemStateName'];
			        }
			    }
			    return item.status;
			}}, 
			{ display: '单位<font color="red">*</font>', name: 'unit',editor : {type :'false'}, width: 80},
		    { display: '<font color="gray">单位换算率</font>', name: 'unitconvert',editor : {type :'false'},width:80,hide:true},
		    { display: '<font color="gray">基本单位数量(本次出库)</font>', name: 'actureQuantity',width: 130},
			{ display: '本次出库数量<font color="red">*</font>', name: 'quantuty',width: 110,editor : {type :'float'}, render: function (item)
			{
			   if(item.quantuty!=''&&item.quantuty!=null&&item.unitconvert!=null&&item.unitconvert!=''){
			   		grid.updateCell('actureQuantity', item.quantuty*item.unitconvert, item);
			   }
			   return item.quantuty;
			}},
			{ display: 'customerID', name: 'customerID', width: 1,hide:true},
			    			{ display: 'bz', name: 'manipulation',editor : {type :'false'}, width: 1,hide:1},
			    			{ display: '操作',width: 100,name:"whetherSelect",
			    			    render: function (record, rowindex, value, column) {
			    			    	var h ="";
			    			    	if(record.whetherSelect=="OK" || findCheckedCustomer(record.customerID) != -1){
			     			    		if (!record._editing)
			     	                    {
			     	                        h += "<a href='javascript:beginEdit(" + rowindex + ")'>修改</a> ";
			     	                        h += "<a href='javascript:cancelEdit(" + rowindex + ")'>取消</a> ";
			     	                    }
			     	                    else
			     	                    {
			    	                        h += "<a href='javascript:endEdit(" + rowindex + ")'>提交</a> ";
			    	                        h += "<a href='javascript:cancelEdit(" + rowindex + ")'>取消</a> "; 
			     	                    }
			    			    		
			    			    	}else{
			    			    		h="修改  取消";
			    			    	}
			    			    	
			                          return h;
			    				  }}
			    			];
			
			
			var column3 =  [
			{ display: 'id', name: 'id',type: 'string',editor : {type :'false'},hide:1},
			{ display: 'materialsid', name: 'materialsid',hide:1,editor : {type :'false'},width:1},
			{ display: '<font color="gray">编码</font>', name: 'code',editor : {type :'false'},width: 100,hide:true},
			{ display: '<font color="gray">名称</font>', name: 'name',editor : {type :'false'},width: 60,hide:true},
			{ display: '<font color="gray">型号</font>', name: 'spec' ,editor : {type :'false'},width: 120,hide:true},
			{ display: '<font color="gray">基本单位</font>', name: 'junit' ,editor : {type :'false'},width: 90,hide:true},
			{ display: '<font color="gray">基本单位数量(订单)</font>', name: 'jquantuty',editor : {type :'false'},width: 120,hide:true},
			{ display: '<font color="gray">基本单位已出库数量</font>', name: 'ycksl',editor : {type :'false'},width: 120,hide:true },
			{ display: '<font color="gray">基本单位库存数量</font>', name: 'kcsl',editor : {type :'false'},width: 120 },
				{ display: '批次<font color="red">*</font>', name: 'batch', width: 90,editor : {type :'false'},
			},
		 	 { display: '状态<font color="red">*</font>', name: 'status',editor : {type :'false'}, width: 80,
				render: function (item)
			    {
			    for (var i = 0; i < ItemStateList.length; i++)
			    {
			        if (ItemStateList[i]['ItemStateID'] == item.status){
			      	  return ItemStateList[i]['ItemStateName'];
			        }
			    }
			    return item.status;
			}}, 
			{ display: '单位<font color="red">*</font>', name: 'unit',editor : {type :'false'}, width: 80},
		    { display: '<font color="gray">单位换算率</font>', name: 'unitconvert',editor : {type :'false'},width:80,hide:true},
		    { display: '<font color="gray">基本单位数量(本次出库)</font>', name: 'actureQuantity',width: 130},
			{ display: '本次出库数量<font color="red">*</font>', name: 'quantuty',width: 110},
			{ display: 'customerID', name: 'customerID', width:  1,hide:1},
			{ display: 'bz', name: 'manipulation', width: 1,hide:1}];
			
if('${billStatus}' == ""){
				grid = $("#table1").ligerGrid({
			        columns: column1, 
//		 	                      enabledEdit: true,
			                      usePager: true,pageSize:1000,pageSizeOptions:[1000],
			                      checkbox: true,rownumbers:true,
			                      enabledSort:false,
			                      isChecked:isCkd,
			                      readonly:false,
			                      enabledEdit: true,clickToEdit:true,onCheckAllRow: f_onCheckAllRow,
			                      onCheckRow:function(checked,data,rowid,rowdata){
			                    	  if(checked){
// 			                    		  grid.beginEdit(rowid);
											addCheckedCustomer(data.customerID);
			                    		  grid.updateCell('whetherSelect', "OK", grid.getRow(rowid));
// 			                    		  alert("a:"+grid.getRow(rowid).whetherSelect);
			                    		  
			                    		  
			                    	  }else{
			                    		  removeCheckedCustomer(data.customerID);
			                    		  grid.updateCell('actureQuantity', "", grid.getRow(rowid));
			                    		  grid.updateCell('quantuty', "", grid.getRow(rowid));
			                    		  grid.updateCell('whetherSelect', "", grid.getRow(rowid));
			                    		  grid.updateCell('val', "", grid.getRow(rowid));
			                    		  
			                    		  
			                    	  }
			                      },
			                      width: "100%", height:"98%",
			                      url : basic_Url+"/itemlist.do?itembatch="+encodeURIComponent(lGetItemDO)+"&whCode="+whCode,
			                      toolbar: { items: [
//		 	                                         { text: '添加', click: insert, icon: 'add' },
			                                         { line: true }
//		 	                                         { text: '删除', click: deleteRow, img: '${ctx}/js/ligerUI/skins/icons/delete.gif' }
			                                         ]
			                                         }
			                  });
}else if('${billStatus}' == "0" || '${billStatus}' == "3"){
				grid = $("#table1").ligerGrid({
			        columns: column2, 
//		 	                      enabledEdit: true,
			                      usePager: true,pageSize:1000,pageSizeOptions:[1000],
			                      checkbox: true,rownumbers:true,
			                      enabledSort:false,
			                      isChecked:isCkd,
			                      enabledEdit: true,clickToEdit:false,onCheckAllRow: f_onCheckAllRow,
			                      onCheckRow:function(checked,data,rowid,rowdata){
			                    	  if(checked){
// 			                    		  grid.beginEdit(rowid);
											addCheckedCustomer(data.customerID);
			                    		  grid.updateCell('whetherSelect', "OK", grid.getRow(rowid));
			                    		  
			                    		  
			                    	  }else{
//		 	                    		  grid.endEdit(rowid);
											removeCheckedCustomer(data.customerID);
			                    		  grid.cancelEdit(rowid);
			                    		  grid.updateCell('actureQuantity', "", grid.getRow(rowid));
			                    		  grid.updateCell('quantuty', "", grid.getRow(rowid));
			                    		  grid.updateCell('whetherSelect', "", grid.getRow(rowid));
			                    		  
			                    	  }
			                      },
			                      width: "100%", height:"98%",
			                      url : basic_Url+"/itemlist.do?itembatch="+encodeURIComponent(lGetItemDO)+"&whCode="+whCode,
			                      toolbar: { items: [
//		 	                                         { text: '添加', click: insert, icon: 'add' },
			                                         { line: true }
//		 	                                         { text: '删除', click: deleteRow, img: '${ctx}/js/ligerUI/skins/icons/delete.gif' }
			                                         ]
			                                         }
			                  });
}else{
				grid = $("#table1").ligerGrid({
			        columns: column3, 
			                      enabledEdit: true,
			                      usePager: true,pageSize:1000,pageSizeOptions:[1000],enabledSort:false, checkbox: true,
			                      url : basic_Url+"/itemlist.do?itembatch="+encodeURIComponent(lGetItemDO)+"&whCode="+whCode,
			                      isChecked:isCkd,
			                      width: "100%", height:"98%"
			                      
			                  });
			}
				
			$("#pageloading").hide();
		
		});
		function getkcQuantity(e){
			if(whCode==null || ""==whCode){
      			$.dialog.alert("请先选择仓库");
      			return ;
      		}
	    	var rowData=grid.getRow($(e).parent()[0]);
	    	if (rowData.batch){
	    		 $.ajax({
	      		      url: "${ctx}/yd/logic/proget/getStorageQuaitity.do",
	      		      global: false,
	      		      type: "POST",
	      		      dataType: "json",
	      		      data: ({
	      		    	maCode : rowData.code,
	      				whCode : whCode,
	      				hubCode : rowData.hubCode,
	      				status : rowData.status,
	      				batch : rowData.batch
	      		      }),		     
	      		      success: function(msg){
	      		    	rowData.kcsl = msg;
	      			 	rowData.auto = true;
	      	   			grid.updateCell('kcsl',msg,rowData);
	      		      }
	      	   });
	   		}else{
	   			$.dialog.alert("请先选择批次");
	   		}
	    }
	    
	    function getBatchkcQuantity(rowData){
	    	if(whCode==null || ""==whCode){
      			$.dialog.alert("请先选择仓库");
      			return ;
      		}
	    	if (rowData.batch){
	    		 $.ajax({
	      		      url: "${ctx}/yd/logic/otherOutwh/getStorageQuaitity.do",
	      		      global: false,
	      		      type: "POST",
	      		      dataType: "json",
	      		      data: ({
	      		    	maCode : rowData.code,
	      				whCode : whCode,
	      				hubCode : rowData.hubCode,
	      				status : rowData.status,
	      				batch : rowData.batch
	      		      }),		     
	      		      success: function(msg){
	      		    	rowData.kcsl = msg;
	      			 	rowData.auto = true;
	      	   			grid.updateCell('kcsl',msg,rowData);
	      		      }
	      	   });
	   		}else{
	   			$.dialog.alert("请先选择批次");
	   		}
	    }
		function getSelected(){
			var rows = grid.getCheckedRows();
			 return rows;
		}
		
		function Close(){
			CloseDialog();
		}
		function insert(){
			if('${billStatus}' != "" && '${billStatus}' != "0" && '${billStatus}' != "3"){
				return false;
			}else{
				var manager = $("#table1").ligerGetGridManager();
				manager.addRow2({
					materialsid: item.materialsid,
		    		code: item.code,
		    		name: item.name,
		    		spec: item.spec,
		    		unit : item.unit,
		    		jquantuty : item.jquantuty,
		    		junit : item.junit,
		    		ycksl : item.ycksl,
		    		kcsl : item.kcsl,
		    		unitconvert : item.unitconvert,
 		    		batch:"",
		    		status:"1"
				});
			}
		}
		function deleteRow()
		{ if('${billStatus}' != "" && '${billStatus}' != "0" && '${billStatus}' != "3"){
			return false;
		}else{
			grid.deleteSelectedRow();
		}
		}
		var ba=true;
		var num = 0;
		var jnum = 0;
		var storageQuantity=0;
		function yz(){
			var data = grid.getSelectedRows();
// 			var data = grid.getData();
			if (data != null && data.length > 0) {
				jnum = 0;
				num = 0;
				for ( var i = 0; i < data.length; i++) {
// 					alert(data[i].toSource());
					if(undefined == data[i].batch||data[i].batch==null||data[i].batch==""){
			           	 $.dialog.alert("您第"+(data[i].__index+1)+"行的“批次”不合法");
			           	 ba=false;
			           	 return false;
			        }
					if (undefined == data[i].status||data[i].status==""
						|| null == data[i].status) {
						$.dialog.alert("第" + (data[i].__index+1) + "行的状态没有选择");
						ba = false;
						return false;
					}
					if(undefined == data[i].quantuty
							|| isNaN(data[i].quantuty)
							|| data[i].quantuty<= 0){
		           	 $.dialog.alert("您第"+(data[i].__index+1)+"行的出库数量不合法");
		           	 ba = false;
		           	 return false;
		            }
		            if (parseFloat(data[i].actureQuantity) > parseFloat(data[i].kcsl)){
		        	   $.dialog.alert("您第"+(data[i].__index+1)+"行的出库数量大于库存数量");
		        	   ba = false;
			           return false;
		           }
					for ( var j = 0; j < data.length; j++) {
	 					if(i != j){
	 						if(data[i].code==data[j].code && data[i].batch==data[j].batch && data[i].status==data[j].status){
	 							ba = false;
	 							$.dialog.alert("第"+(data[i].__index+1)+"行与第"+(data[j].___index+1+1)+"行存在相同的批次与等级!");
	 							return false;
	 						}
	 					}
	 				}
					storageQuantity += parseFloat(data[i].kcsl);
					num	+= parseFloat(data[i].quantuty);
					jnum +=parseFloat(data[i].actureQuantity);
			//		if(jnum>(parseFloat(data[i].jquantuty)-parseFloat(data[i].ycksl==null ? 0.0 :data[i].ycksl))){
			//			ba = false;
			//			$.dialog.alert("出库数量合计大于“订单未出库数量”");
			//			return false;
			//		}
	 			}
			}
				ba=true;
		}
		
		function isCkd(rowData){
// 			alert("ssss:"+rowData.toSource());
			if(rowData.manipulation=="x"){
				if(rowData.whetherSelect!="OK"){
					grid.updateCell('whetherSelect', "OK", rowData);
				}
				return true;
			}else if(rowData.manipulation!="x"){
				if (findCheckedCustomer(rowData.customerID) == -1)
// 					grid.updateCell('whetherSelect', "OK", rowData);
	                return false;
	            return true;
			}
			return false;
		}
		function cancelEdit(rowid) { 
            grid.cancelEdit(rowid);
        }
        function endEdit(rowid)
        {
        	grid.endEdit(rowid);
        }
        function beginEdit(rowid) { 
        	grid.beginEdit(rowid);
        }
        
        function CheckedValue(e){
        	var rowData=grid.getRow($(e).parent()[0]);
        	if(grid.isSelected(rowData.__index)){
        		if(rowData.quantuty==null || ""==rowData.quantuty||rowData.quantuty==undefined||isNaN(rowData.quantuty)){
        			$.ligerDialog.confirm("该行的值为空是否取消选中?", 
               				function (flag) { 
               				if(flag){
               					  grid.unselect(rowData.__index);
               					  grid.updateCell('actureQuantity', "", rowData);
	                    		  grid.updateCell('quantuty', "", rowData);
	                    		  grid.updateCell('val', "", rowData);
	                    		  grid.updateCell('whetherSelect', "", rowData);
               				}else{
               					  grid.updateCell('actureQuantity', "", rowData);
	                    		  grid.updateCell('quantuty', "", rowData);
	                    		  grid.updateCell('val', "", rowData);
               				}
               			});
        		}
        		
        	}else{
        		if(rowData.val!=null &&""!=rowData.val&&rowData.val!=undefined&&!isNaN(rowData.val)){
        		$.ligerDialog.confirm("该行没有被选中是不可以编辑的,是否选中编辑?", 
           				function (flag) { 
           				if(flag){
           					grid.select(rowData.__index);
           					grid.updateCell('whetherSelect', 'OK', rowData);
           					if(rowData.val!=null && ""!=rowData.val){
           						grid.updateCell('quantuty', rowData.val, rowData);
               					grid.updateCell('actureQuantity', rowData.val*rowData.unitconvert, rowData);
               					grid.updateCell('val', "", rowData);
           					}
           				}else{
         					  grid.updateCell('actureQuantity', "", rowData);
                    		  grid.updateCell('quantuty', "", rowData);
                    		  grid.updateCell('val', "", rowData);
           				}
           			});
        		}
        	}
        }
        function f_onCheckAllRow(checked)
        {
            for (var rowid in this.records)
            {
                if(checked)
                    addCheckedCustomer(this.records[rowid]['customerID']);
                else
                    removeCheckedCustomer(this.records[rowid]['customerID']);
            }
        }
        function findCheckedCustomer(customerID)
        {
            for(var i =0;i<checkedCustomer.length;i++)
            {
                if(checkedCustomer[i] == customerID) return i;
            }
            return -1;
        }
        function addCheckedCustomer(customerID)
        {
            if(findCheckedCustomer(customerID) == -1)
                checkedCustomer.push(customerID);
        }
        function removeCheckedCustomer(customerID)
        {
            var i = findCheckedCustomer(customerID);
            if(i==-1) return;
            checkedCustomer.splice(i,1);
        }
//         function f_isChecked(rowdata)
//         {
//             if (findCheckedCustomer(rowdata.customerID) == -1)
//                 return false;
//             return true;
//         }
//         function f_onCheckRow(checked, data)
//         {
//             if (checked) addCheckedCustomer(data.customerID);
//             else removeCheckedCustomer(data.customerID);
//         }
//         function f_getChecked()
//         {
//             alert(checkedCustomer.join(','));
//         }
	</script>
	
  </head>
 <body style="padding:10px" onload="createSearch()"> <div>
 <form id="showForm">
 <input type="hidden" id="batchItem" name="batchItem"/>
		<!-- <div class="pageContent"> -->
		<!-- 	<div class="panel"> -->
				<table class="TableBlock" align="center">
					<tr>
						<td nowrap="nowrap">编码:</td>
						<td><input id="code" name="code" class="inp_width_98p" readonly="readonly" value="${itemdo.code}" /></td>
						<td nowrap="nowrap">名称:</td>
						<td><input id="name" name="name" class="inp_width_98p" readonly="readonly" value="${itemdo.name}" /></td>
					</tr>
					<tr>
						<td nowrap="nowrap">型号:</td>
						<td><input id="spec" name="spec" class="inp_width_98p" readonly="readonly" value="${itemdo.spec}" /></td>
						<td nowrap="nowrap">基本单位:</td>
						<td><input id="junit" name="junit" class="inp_width_98p" readonly="readonly" value="${itemdo.junit}" /></td>
					</tr>
					<tr>
						<td nowrap="nowrap">基本单位数量(订单):</td>
						<td><input id="jquantuty" name="jquantuty" class="inp_width_98p" readonly="readonly" value="${itemdo.jquantuty}" /></td>
						<td nowrap="nowrap">基本单位已出库数量:</td>
						<td><input id="ycksl" name="ycksl" class="inp_width_98p" readonly="readonly" value="${itemdo.ycksl}" /></td>
					</tr>
				</table>
			<!-- </div> -->
		<!-- </div> -->
   </form> </div>
      <div id="layout1" style="height: 20%" >
     	 <div position="top">
<!--     <div class="panelBar"> -->
<!--        <ul class="toolBar"> -->
<!--        <li><a class="add" onclick="insert()"><span>新增</span></a></li> -->
<!--    		<li><a class="delete" onclick="deleteRow()"><span>删除</span></a></li> -->
<!--          </ul> -->
<!--     </div> -->
			  <div>
				<font color="red"><input type="button" id="case"  style="color:red" value="展开查询"/></font>
			  </div>
	          <div id="pageHeader" class="pageHeader" style="display:none">
	               <div class="searchBar" id="multipleSearchDialog">
		                <table class="table" width="100%" id="searchHeader" >  
	                        <tbody id="newbody">
	                        </tbody>
	 	                </table>
	                    <div class="subBar">
				             <ul>
					             <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="searchAP()">查询</button></div></div></li>
					             <li><a class="button" onclick="clearSearch1()"><span>重置</span></a></li>
				             </ul>
		                </div>
	               </div>
	          </div>
	       </div>
      </div>
      <div position="center" id="table1" style="height: 80%">
      </div>
      <div class="clear"></div>
    </body>
</html>